package org.excample.entity;

import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import net.minidev.json.annotate.JsonIgnore;

import java.util.Date;

public class User {
    @NotNull
    private Integer id;
    private String username;
    @JsonIgnore//配置SpringMVC把当前对象转换成JSON时忽略该属性
    private String password;
    @NotEmpty
    @Email
    private String email;
    @NotEmpty//字符串不能为空
    @Pattern(regexp = "^\\S{1,10}$")//正则表达式对内容进行验证
    private String nickname;
    private String user_pic;
    private Date create_time;
    private Date update_time;

    public User() {
    }

    public User(Integer id, String username, String password, String email, String nickname, String user_pic, Date create_time, Date update_time) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.email = email;
        this.nickname = nickname;
        this.user_pic = user_pic;
        this.create_time = create_time;
        this.update_time = update_time;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getUser_pic() {
        return user_pic;
    }

    public void setUser_pic(String user_pic) {
        this.user_pic = user_pic;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public Date getCreate_time() {
        return create_time;
    }

    public void setCreate_time(Date create_time) {
        this.create_time = create_time;
    }

    public Date getUpdate_time() {
        return update_time;
    }

    public void setUpdate_time(Date update_time) {
        this.update_time = update_time;
    }
}
